package com.qn.analyze.controlle;

import cn.dev33.satoken.annotation.SaCheckLogin;
import cn.dev33.satoken.annotation.SaIgnore;
import com.qn.analyze.entity.*;
import com.qn.analyze.service.UserMetricsService;
import com.qn.analyze.vo.*;
import com.qn.common.base.BaseControlle;
import com.qn.common.base.model.BasicFetchPage;
import com.qn.common.base.model.ResponseData;
import com.qn.common.base.model.ResponseRows;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
/**
 * qingniu-cloud user source analysis
 *
 * @Author: TXG
 * @Date: 2024/6/11
 * @Version V0.0.2
 */

@Tag(name = "系统-访客指标统计")
@SaCheckLogin
@RestController
@RequestMapping("user/metrics")
public class UserMetricsController extends BaseControlle {
    @DubboReference(version = "1.0.0")
    private UserMetricsService service;
    @Operation(summary ="访客统计-列表")
    @PostMapping("getList")
    @SaIgnore
    public ResponseData<BasicFetchPage<UserMetrics>> getList(@RequestBody UserMetricsQueryVo where){
        return successD(service.getList(where));
    }
    @Operation(summary ="访客统计-计数")
    @PostMapping("getListCount")
    @SaIgnore
    public ResponseData<Integer> getListCount(@RequestBody UserMetricsQueryVo where){
        return successD(service.getListCount(where));
    }


    @Operation(summary ="访客JA4统计-列表")
    @PostMapping("getJA4List")
    @SaIgnore
    public ResponseData<BasicFetchPage<UserMetrics>> getJa4List(@RequestBody UserMetricsQueryVo where){
        return successD(service.getJa4List(where));
    }
    @Operation(summary ="访客JA4统计-计数")
    @PostMapping("getJA4ListCount")
    @SaIgnore
    public ResponseData<Integer> getJa4ListCount(@RequestBody UserMetricsQueryVo where){
        return successD(service.getJa4ListCount(where));
    }

    @Operation(summary ="访客CKF统计-列表")
    @PostMapping("getCKFList")
    @SaIgnore
    public ResponseData<BasicFetchPage<UserMetrics>> getCkfList(@RequestBody UserMetricsQueryVo where){
        return successD(service.getCkfList(where));
    }
    @Operation(summary ="访客CKF统计-计数")
    @PostMapping("getCKFListCount")
    @SaIgnore
    public ResponseData<Integer> getCkfListCount(@RequestBody UserMetricsQueryVo where){
        return successD(service.getCkfListCount(where));
    }

    @Operation(summary ="访客IP4统计-列表")
    @PostMapping("getIP4List")
    @SaIgnore
    public ResponseData<BasicFetchPage<UserMetrics>> getIp4List(@RequestBody UserMetricsQueryVo where){
        return successD(service.getIp4List(where));
    }
    @Operation(summary ="访客IP4统计-计数")
    @PostMapping("getIP4ListCount")
    @SaIgnore
    public ResponseData<Integer> getIp4ListCount(@RequestBody UserMetricsQueryVo where){
        return successD(service.getIp4ListCount(where));
    }
    @Operation(summary ="域名统计-计数")
    @PostMapping("getHostList")
    @SaIgnore
    public ResponseRows<UserMetrics> getHostList(@RequestBody UserMetricsQueryVo where){
        return successR(service.getHostList(where));
    }

    @Operation(summary ="来源统计-计数")
    @PostMapping("getRefererList")
    @SaIgnore
    public ResponseRows<UserMetrics> getRefererList(@RequestBody UserMetricsQueryVo where){
        return successR(service.getRefererList(where));
    }
}